import requests

# 1. URL参数

# # 方式一：手动拼接参数
# url = "https://httpbin.org/get?name=John&age=30"
# response = requests.get(url)
# print(response.status_code)

# # 方式二：更优雅的方式-》用 params 参数
# params = {"name": "John", "age": 30}
# response = requests.get("https://httpbin.org/get", params=params)
# print(response.status_code)

# 2.请求头
headers = {
    "User-Agent": "Mozilla/5.0",  # 模拟浏览器访问
    "Authorization": "Bearer your_token"  # 身份验证
}
response = requests.get("https://www.baidu.com", headers=headers)
print(response.status_code)